UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NUqSk8YAm7QFHOmyS8NsZHPSkB9MOl+fgGAYfGn4/6M=' 
WHERE 
  key_id = '3ddfacaf383acaf6c844345d9e79dc8212841671487106f6dad695699ad2a5f9' 
  AND (
    token = 'NUqSk8YAm7QFHOmyS8NsZHPSkB9MOl+fgGAYfGn4/6M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042