UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sACOSgffrLvnEyex08aeIgO0EcGtZfHsh/6pqa8kA2w='
WHERE
key_id = 'f8eb703b16baac7d972cca24170ad2b680f67237145a9056a28b55fc1e08bedb'
AND (
token = 'sACOSgffrLvnEyex08aeIgO0EcGtZfHsh/6pqa8kA2w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)