UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HARpN/JRVsY+ZT/V9s1VYPGYHvEhFlh2Yc38J9SWES8=' 
WHERE 
  key_id = 'c4a714999a6b45dd9f48fc22466184620289cec3fd90d7548f56ec37709388f9' 
  AND (
    token = 'HARpN/JRVsY+ZT/V9s1VYPGYHvEhFlh2Yc38J9SWES8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035