UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dy7ADKH5fBALqafjvo4wm6AS+64rWZnYJE5PiWwpB0s='
WHERE
key_id = '605d55aba819df0313c76472ebbb6a32534b5d22a9a246f80a13ae6d0e9b771d'
AND (
token = 'dy7ADKH5fBALqafjvo4wm6AS+64rWZnYJE5PiWwpB0s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)