UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HqgFmkCw76GFREzhqgWahImpohbIV2vhoNi9OFLwKP8=' 
WHERE 
  key_id = '8a124c66b5d706e073c1de225b97c0a16450c95470659730ce5a550b1b78c12e' 
  AND (
    token = 'HqgFmkCw76GFREzhqgWahImpohbIV2vhoNi9OFLwKP8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029