UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sO+iFBDGZrrp9jeAKrcB36jKpmHNuRvB/a+4wiPsqU0=' 
WHERE 
  key_id = '852b4cc74a2f57e6bb58d398a26891a99e96caa7bfef7809a6ff69be7f992588' 
  AND (
    token = 'sO+iFBDGZrrp9jeAKrcB36jKpmHNuRvB/a+4wiPsqU0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00080