UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Lr0vQPu72cZqh3roz/g3tn92TjpBXxNBAY6KBrSAdM0='
WHERE
key_id = '9851f09ee2280ec14339f706238f527a56d5c5ee0390637c3bcab1337138edbb'
AND (
token = 'Lr0vQPu72cZqh3roz/g3tn92TjpBXxNBAY6KBrSAdM0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)