UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x625GNqWPgC0oABKFwjCom/eSfF64fu5svqQfgAFtkI='
WHERE
key_id = 'd4bd0652507a9d17a6a4c1c0a8dbdf6c08016bf1ac026e1d1dd42a4bd6cd78f0'
AND (
token = 'x625GNqWPgC0oABKFwjCom/eSfF64fu5svqQfgAFtkI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)