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

Query time 0.00029