UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Sz5m3by1+zZIMrzI4yWXt7y2fHK8Ctc9EWbX03gF9D0='
WHERE
key_id = 'f04b48e1f0029070b836a7f8c186b39af61955523b3c254960a9d5ff41f93ace'
AND (
token = 'Sz5m3by1+zZIMrzI4yWXt7y2fHK8Ctc9EWbX03gF9D0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)