UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gCxwymzM7KKETqtz5BnNpKaauBC3NRHvW4yX25zpcbM='
WHERE
key_id = 'd2b7b72c78040b4602fb7a92e18b37db4d6ee843c643259c8ae0e325a08cbf0b'
AND (
token = 'gCxwymzM7KKETqtz5BnNpKaauBC3NRHvW4yX25zpcbM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)