UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'siOAX9bowITT9uzdtg3NNThnhcOmVZfuHQx8SfkH8+o=' 
WHERE 
  key_id = '72a4852d1c73505d0e547b517e3446e376bcc43a0b7f692342acff33f1099d11' 
  AND (
    token = 'siOAX9bowITT9uzdtg3NNThnhcOmVZfuHQx8SfkH8+o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039