UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VX5rmU7YOlFycq7dB4pPqDSxLKITzvMFB4niU3u3kHU='
WHERE
key_id = '6b527c032c3fc3eceff6a76b3a02fa960a1e2c29b09354ad763a05451dc11f20'
AND (
token = 'VX5rmU7YOlFycq7dB4pPqDSxLKITzvMFB4niU3u3kHU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)