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

Query time 0.00026