UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W0f3dqERbH2/6zzximGRbPK/WUMDgPw7KuOi5JHFd0M='
WHERE
key_id = '9235b0c43a3ebb58f27fc32c54e8df419eb867c6098330fae9b62d225e5ccea6'
AND (
token = 'W0f3dqERbH2/6zzximGRbPK/WUMDgPw7KuOi5JHFd0M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)