UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7ratBkFheclXG3mkpXcQIURjfAP3nE3OctKEWWvnMWo=' 
WHERE 
  key_id = 'cd5b749b63d0308e1821b56a0572926186e34f8581329f0a4005f8b49d75fef9' 
  AND (
    token = '7ratBkFheclXG3mkpXcQIURjfAP3nE3OctKEWWvnMWo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044