UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jYal6lUE0GgbedylK06qzBV7beFb5jNyvWdsc3KP4dY=' 
WHERE 
  key_id = '1294d6be22adf7c149c5d6e3b917709f5ae9a7e2f263210ea16a780c669748cb' 
  AND (
    token = 'jYal6lUE0GgbedylK06qzBV7beFb5jNyvWdsc3KP4dY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031