UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SEtpSc7vKWe2PhUdKSm1CwfGJkk5mbYOeyG4Y7kiqmk='
WHERE
key_id = '23631291941f65a43535646c2f4c578cf62948c59fd5d07b7072a4a8b8bb288d'
AND (
token = 'SEtpSc7vKWe2PhUdKSm1CwfGJkk5mbYOeyG4Y7kiqmk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)