UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FNv5S+JiEgPxay/4czHAS1YVyI4iBehZWBpuvNptA5k='
WHERE
key_id = 'f1b49001cd37a948080ddff315aefa2ca7864a3861a9ed0c54f603dfb441ee0f'
AND (
token = 'FNv5S+JiEgPxay/4czHAS1YVyI4iBehZWBpuvNptA5k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)