UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gPQjs78E03MyOCbdbBxw7MHMI1DS0kk+kd9aU4y324Y='
WHERE
key_id = 'ec3907c59f58bdd1b9307e6a24ddea6fbaed0ec4df4adb5451a662bdbbc4a65e'
AND (
token = 'gPQjs78E03MyOCbdbBxw7MHMI1DS0kk+kd9aU4y324Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)