UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OoiqkabQXpPdOEdtYlOvelM6Rq+LXqh3L1bG0cgao3c='
WHERE
key_id = '50e4291fa6085b2b20a52889661f1b13e7774fc221a4359dd0ba9723b872a255'
AND (
token = 'OoiqkabQXpPdOEdtYlOvelM6Rq+LXqh3L1bG0cgao3c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)