UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N9pVIJ1leEjYLcByHNrdSHPHIIlF7u+1EZ6A0cXsomk='
WHERE
key_id = '77cfb3bb8929c96a5165a5083f6445e93147dcdf6c0e1bdca364d1dc54c5468d'
AND (
token = 'N9pVIJ1leEjYLcByHNrdSHPHIIlF7u+1EZ6A0cXsomk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)