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

Query time 0.00048