UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ttBdU+48W8QltiPSE9YKgbbu04TzjdhDujOTLlg3VjA='
WHERE
key_id = '3bce45641a39f9f0ef9ace8a3939d8c0ce5a69e3157eedad6a2adcd4a1955a3b'
AND (
token = 'ttBdU+48W8QltiPSE9YKgbbu04TzjdhDujOTLlg3VjA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)