UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T17EwrPRj7mTBtJuWkwZFbHc3qB6TdvL0lY8WoHhJSI='
WHERE
key_id = '164ba062787665623e03d16eb92584ea09bda123d72c6c523a0e7c0854fd4022'
AND (
token = 'T17EwrPRj7mTBtJuWkwZFbHc3qB6TdvL0lY8WoHhJSI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)