UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6ILImcVAJjW4s7sG6qBKhC8gi6MNsl9vme1FCK9LJ10='
WHERE
key_id = '347a9f68971599a1d4de9af177c445a7dfe1ac830d2e244911b454c252d4f765'
AND (
token = '6ILImcVAJjW4s7sG6qBKhC8gi6MNsl9vme1FCK9LJ10='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)