UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZMWu85SiXd9Myq/O+ylvFmZC0i+Zlhg2E/1h/+IwHls='
WHERE
key_id = 'b66b7730f87e5abed655c454f8afa1b3f60fd3777c9258402a6ea779314fea05'
AND (
token = 'ZMWu85SiXd9Myq/O+ylvFmZC0i+Zlhg2E/1h/+IwHls='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)