UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jmfOzbnzyHk0CR37y/F4nANLvw7VM58WnNoBssJpS1I='
WHERE
key_id = '502124295893d72ad72482ad682a3d6554dbfdb6c906974674d377309a9b9a88'
AND (
token = 'jmfOzbnzyHk0CR37y/F4nANLvw7VM58WnNoBssJpS1I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)