UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NOtD+YkNi21X8QZxfAqiH6czW22vu5ER60l44G2fqHM='
WHERE
key_id = 'bd67f2b3c010a04fb714296d8a984cb3b5d4f5667a2a49d6ed5b9afb5b6b4259'
AND (
token = 'NOtD+YkNi21X8QZxfAqiH6czW22vu5ER60l44G2fqHM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)