UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VCmfoys5PCQV8v1ZdK07bFz6wrfd6WiGFIenIMaE16g='
WHERE
key_id = '57dd216916a50e040e4440c5c039ee21a2895dd0cc5646714f868533c8392ff9'
AND (
token = 'VCmfoys5PCQV8v1ZdK07bFz6wrfd6WiGFIenIMaE16g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)