UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lSqP4kotVllBU2XsgowlctzKZfas0Per/D90SO8RS4Y=' 
WHERE 
  key_id = 'c62aafb0ff049c47e5f85312ab2aa5c8160dc87f2973711cb63b775a4f0c0094' 
  AND (
    token = 'lSqP4kotVllBU2XsgowlctzKZfas0Per/D90SO8RS4Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034