UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kxoBO4iqs1PW3sv5ixXeXTOtvzYojZOVZiLrc/98zms='
WHERE
key_id = '8138378b23919bfe67eaa54b6f0acda778a4143d75db8105de3a3f69393eb203'
AND (
token = 'kxoBO4iqs1PW3sv5ixXeXTOtvzYojZOVZiLrc/98zms='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)