UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y3utdhwcU7gcY8goN3ES7VOpO44G/qrAYYOCuLvjyLY='
WHERE
key_id = 'b16e73937adb2c8e2d85e10e7dcb8722d7d07d3157fd3245ea1e8bce3a9c499d'
AND (
token = 'y3utdhwcU7gcY8goN3ES7VOpO44G/qrAYYOCuLvjyLY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)