UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SSIIZOazMhD8zGy1Nu4JVXREj0xq3qZR4gEV8qrTB2U=' 
WHERE 
  key_id = 'a683518d0c46525c546e842cf332c4447d937b588d7695415809de7f9b757cb8' 
  AND (
    token = 'SSIIZOazMhD8zGy1Nu4JVXREj0xq3qZR4gEV8qrTB2U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026