UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9YNT8owp+lVyOxKFkoGdF3kyTk3BUz7HddPD6RCGHjA='
WHERE
key_id = '3874c914cd751f5e91a92175caa753937609c5c7656cbf164b067a323aa8e8bb'
AND (
token = '9YNT8owp+lVyOxKFkoGdF3kyTk3BUz7HddPD6RCGHjA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)