UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tZRjTbzYvv+IM0itHO0zhawaG/SbihLNc69uWrLsb00=' 
WHERE 
  key_id = 'd28809602fa95df92500a5ac6ef2e5a058260a5eae2ea490889fe860e3a8137b' 
  AND (
    token = 'tZRjTbzYvv+IM0itHO0zhawaG/SbihLNc69uWrLsb00=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023