UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BgMTNKeBVinamnC3ZrQPpxpsMSXRds+7U9XWlyGwkDQ='
WHERE
key_id = 'cf4fb5f1e4db6a53a70380e103778ab369ce87a5e5beecc3727de6d56eef78e6'
AND (
token = 'BgMTNKeBVinamnC3ZrQPpxpsMSXRds+7U9XWlyGwkDQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)