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

Query time 0.00030