UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GdE48CcSo9+ikZfaF+d+JnRCia7seGHFy67YDKPxfaw=' 
WHERE 
  key_id = '4bb057871868ea0ec8fd9ded9cbf25a6770862ea1f34927f0b3f5a061e6c56d1' 
  AND (
    token = 'GdE48CcSo9+ikZfaF+d+JnRCia7seGHFy67YDKPxfaw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024