UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xWpFV1/LDjvk63zTfEoK9b+BpFt9dgP6vZEUkZE3OxE='
WHERE
key_id = '7da50513b4554ff2b3c6c38cc661c56f9482463e6218003771141cc96056a063'
AND (
token = 'xWpFV1/LDjvk63zTfEoK9b+BpFt9dgP6vZEUkZE3OxE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)