UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JTFmgUgpN2zT0sYrFA4A0A34wWU98eRJ/lIVJl1QeN0='
WHERE
key_id = 'b650a31955c00a327ec8ccb28b372889989a878492d6091302c2170a7b6a3cda'
AND (
token = 'JTFmgUgpN2zT0sYrFA4A0A34wWU98eRJ/lIVJl1QeN0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)