UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nUtv7uk5GCyux4hlRqiWj9sxhjiK8ci03j7TPx0FxK4='
WHERE
key_id = '684056f797ea9d8bbc99579e00d8e7c89e823dc16d812a76b10a3ce268b158fd'
AND (
token = 'nUtv7uk5GCyux4hlRqiWj9sxhjiK8ci03j7TPx0FxK4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)