UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'L/cURyb429L0g0B7W25NoG6CHr196ftO4Gf9gHG9P2Q='
WHERE
key_id = 'bda59861528f63ae2a85e4fd5b32b2ea5fbf315097acc9edea4099042ac13f10'
AND (
token = 'L/cURyb429L0g0B7W25NoG6CHr196ftO4Gf9gHG9P2Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)